<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="MvcContrib.FluentHtml.ModelViewPage<Universum.Model.Domain.Classes.Class>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Universum - Edit class
</asp:Content>
<asp:Content ContentPlaceHolderID="Breadcrumbs" ID="BreadcrumbsContent" runat="server">
	<%=Html.Breadcrumb().Home().Append<ClassesController>(c=>c.Index(),"Your classes").Class(Model.ID).AppendText("Edit class ").End() %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>
		Edit class</h2>
	<%
		if (Html.IsOwnerLoggedIn(Model.Owner))
		{
			using (Html.BeginForm<ClassesController>(callFor => callFor.RemoveClass(Model.ID), FormMethod.Post))
			{
				Writer.Write(this.SubmitButton("Remove entry"));
			}
		}				%>
	<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
	<% using (Html.BeginForm<ClassesController>(controller => controller.EditClass(null)))
	{%>
	<fieldset>
		<legend>Fields</legend>
		<p>
			<%= this.TextBox( model => model.Name).Label("Name") %>
			<%= this.ValidationMessage( model => model.Name, "*") %>
		</p>
		<p>
			<%= this.TextArea( model => model.Description).Label("Description") %>
			<%= this.ValidationMessage( model => model.Description, "*") %>
		</p>
		<p>
			<%= this.CheckBox(model=> model.IsActive).Label("Active? ") %>
		</p>
		<p>
			<% if (Html.IsOwnerLoggedIn(Model.Owner))
			   { %>
			<%= this.SubmitButton("Save")%>
			<% } %>
			or
			<%=Html.UserActionLink< ClassesController >( controller => controller.Show(Model.ID), "Cancel") %>
		</p>
	</fieldset>
	<% } %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
	<% Html.RenderPartial("EditorAndDateUserControl"); %>
</asp:Content>
